import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
import HomePage from '@/pages/home';
import LoginPage from '@/pages/login';
import ImageEditPage from '@/pages/imageEdit';
import VideoEditTestPage from '@/pages/videoEditTest';
import NotFoundPage from '@/pages/not-found';
import AuthGuard from '@/components/auth-guard';
import LoginGuard from '@/components/login-guard';
import VideoEditPage from '@/pages/video';
import AudioEditPage from '@/pages/audio';
import TextToVideo from '@/pages/video/sub/textToVideo';
import ImageToVideo from '@/pages/video/sub/imageToVideo';
import FrameToVideo from '@/pages/video/sub/frameToVideo';
import ElementsAdd from '@/pages/video/sub/elementsAdd';

// 导入其他子路由组件
import VideoPost from '@/pages/video/sub/videoPost';

import DubbingMake from '@/pages/audio/sub/dubbingMake';
import ControlSpeechSynthesis from '@/pages/audio/sub/controlSpeechSynthesis';
import SoundBank from '@/pages/audio/sub/soundBank';



const router = (
  <BrowserRouter future={{ v7_relativeSplatPath: true,v7_startTransition:true }}>
    <Routes>
      <Route path="/" element={<AuthGuard><HomePage /></AuthGuard>} />
      <Route path="/login" element={<LoginGuard><LoginPage /></LoginGuard>} />
      <Route path="/imageEdit" element={<AuthGuard><ImageEditPage /></AuthGuard>}>

      </Route>
      <Route path="/videoEditTest" element={<AuthGuard><VideoEditTestPage /></AuthGuard>} />
      <Route element={<AuthGuard><VideoEditPage /></AuthGuard>} >
        <Route path="/textToVideo" element={<TextToVideo />} />
        <Route path="/imageToVideo" element={<ImageToVideo />} />
        <Route path="/frameToVideo" element={<FrameToVideo />} />
        <Route path="/elementsAdd" element={<ElementsAdd />} />
        <Route path="/videoPost" element={<VideoPost />} />
      </Route>
      <Route element={<AuthGuard><AudioEditPage /></AuthGuard>} >
        <Route path="/controlSpeechSynthesis" element={<ControlSpeechSynthesis />} />
        <Route path="/dubbingMake" element={<DubbingMake />} />
        <Route path="/soundBank" element={<SoundBank />} />
      </Route>
      <Route path="/404" element={<NotFoundPage />} />
      <Route path="*" element={<Navigate to="/404" replace />} />
    </Routes>
  </BrowserRouter>
);

export default router;